﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using log4net;
using Microsoft.Extensions.Logging;

namespace Blog.Framework.Log4Net
{
    public class Log4NetLoggerProvider : ILoggerProvider
    {
        private readonly ILog _log;

        public Log4NetLoggerProvider()
        {
            _log = LogManager.GetLogger(Assembly.GetEntryAssembly(), "Log4NetLogger");
        }

        public ILogger CreateLogger(string categoryName)
        {
            return new Log4NetLogger(_log);
        }

        public void Dispose()
        {
            // 不需要做任何事情，因为ILog实例由log4net管理
        }
    }
}
